(function(window) {//地图渲染类
    class Map {
        constructor(width, height, x, y, bgd) {
            this.width = width;
            this.height = height;
            this.x = x;
            this.y = y;
            this.bgColor = bgd;
        }
        render = function() {
            let newDiv = document.createElement('div');
            newDiv.className = 'map';
            newDiv.style.position = 'absolute';
            newDiv.style.left = `${this.x}rem`;
            newDiv.style.right = `0rem`;
            newDiv.style.top = `${this.y}rem`;
            newDiv.style.width = `${this.width + 0.2}rem`;
            newDiv.style.height = `${this.height + 0.2}rem`;
            newDiv.style.background = this.bgColor;
            newDiv.style.border = `0.1rem solid #aaa`;
            this.rendered = newDiv;
            document.body.appendChild(newDiv);
        }
        remove = function() {
            if (this.rendered) {
                document.body.removeChild(this.rendered);
                this.rendered = null;
            }
        }
    }
    window.Map = Map;
}(window))